package experiment9;

import java.io.*;

public class No_2 {
    public static void main(String []args) throws IOException {
        String filepath=args[0];

        File file=new File(filepath);

        //存储文章内容
        StringBuffer mainStr=new StringBuffer();

        BufferedReader reader=new BufferedReader(new FileReader(file));

        String tempStr;
        int i=0;
        while ((tempStr=reader.readLine())!=null){
            i++;
            mainStr.append(tempStr);
        }
        reader.close();

        System.out.println("there are "+i+" lines");
        int word=0;
        int space=0;
        int character=0;
        for (int j=0;j<mainStr.length();j++){
            if (mainStr.charAt(j)==' '){
                space++;
            }
        }
        character=mainStr.length()-space;
        word=space+i;

        System.out.println(character+" characters");
        System.out.println(word+" words");
    }
}
